#include<iostream>
#include<fstream>
 #include<string>
 #include<vector>
 #include<sys/stat.h>
 namespace cloud{
         class FileUtil
{
                 private:
                         std::string _filename;
                  public:
                          FileUtil(const std::string &filename):_filename(filename){}
                          int64_t filesize()
                          {
                                  struct stat st;
                                  if(stat(_filename.c_str(),&st)<0)
                                  {
                                          std::cout<<"get file size failed!\n";
                                          return -1;
                                 }
                                  return st.st_size;
  
                          }
                          time_t LastMtime(){
                                 struct stat st;
                                  if(stat(_filename.c_str(),&st)<0)
                                  {
                                          std::cout<<"get file last mtimg failed!\n";
                                          return -1;
                                  }
                                  return st.st_mtime;
                          }
  
                          time_t LastAtime(){
                                  struct stat st;
                                  if(stat(_filename.c_str(),&st)<0)
                                  {
                                          std::cout<<"get file last atimg failed!\n";
                                          return -1;
                                  }
                                  return st.st_atime;
                          }
                          std::string filename()
                          {
                                  size_t pos;
                                 pos=_filename.find_last_of("/");
                                  if(pos==std::string::npos)
                                  {
                                          std::cout<<"find name failed!\n";
                                          exit;
                                  }
                                  }
                                  return _filename.substr(pos+1);
                          }
  };
  }

                                                                                          